Left Function

Returns the first n characters in a source String.

Syntax

result = Left( source, count )

result = stringVariable.Left( count )


Parameters

source

String

The source string from which to get the characters.

count

Integer

The number of characters you wish to get from source. If count is greater than the number of characters in source, all characters are returned.



Notes

The Left function returns characters from the source String starting from the left side (as the name implies).

If you need to read bytes rather than characters, use the LeftB function.


Example

This example returns the first five characters in a String.

Dim s As String
s=Left("Hello World", 5) //returns "Hello"

See Also

Asc, Chr, InStr, Len, LeftB, Mid, Right functions.